USE [OctoNetApps]
GO

/****** Object:  StoredProcedure [classified].[ClassifiedAttributes_Sort]    Script Date: 05/25/2011 07:00:42 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO




CREATE PROCEDURE [classified].[ClassifiedAttributes_Sort]
	@Attributes searchattributes readonly-- AttributeValue contains new SortOrder
AS
BEGIN
	SET NOCOUNT ON;
	
	BEGIN TRY

		BEGIN TRANSACTION TR
			MERGE classified.ClassifiedAttributes ca
			USING @Attributes a ON (a.AttributeID = ca.AttributeID)
				WHEN MATCHED THEN
					UPDATE SET SortOrder = a.AttributeValue;

		COMMIT TRANSACTION TR
    END TRY
    BEGIN CATCH
		ROLLBACK TRANSACTION TR
    END CATCH
END









GO


